<script setup lang="ts">
import { reactive, ref } from "vue";
import CountUp from "@/components/count-up";
import BarLeft from "@/components/bar-left/index.vue";

const getProgressData = (data: any) => {
    let obj = JSON.parse(data)
    progressData.value[0].valueB = obj.totalInstalled
    progressData.value[0].value = obj.totalGeneration
    progressData.value[1].valueB = obj.totalGreenSupply
    progressData.value[1].value = obj.greenConsumption
    progressData.value[3].valueB = obj.totalStorageCapacity
    progressData.value[3].value = obj.actualStoredEnergy
    progressData.value[4].valueB = obj.totalDirectSupply
    progressData.value[4].value = obj.directSupplyUtilization
    progressData.value[5].valueB = obj.totalAbandonedPower
    progressData.value[5].value = obj.totalAbandonedPowerUtilized
    progressData.value[6].value = obj.abandonedPowerUtilization
}


defineExpose({
    getProgressData
})


const progressData = ref([
    {
        name: '光伏发电总量',
        value: 0,
        valueB: 0,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '',
    },
    {
        name: '绿电消纳总量',
        value: 0,
        valueB: 0,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '',
    },
    {
      isShowDivider: true,
    },
    {
        name: '储能装机总量',
        value: 0,
        valueB: 0,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '',
    },
    {
        name: '绿电直供总量',
        value: 0,
        valueB: 0,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '',
    },
    {
        name: '弃电利用总量',
        value: 0,
        valueB: 0,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '',
    },
    {
        name: '弃电利用率',
        value: 0,
        valueB: 100,
        color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
        type: 1,
        unit: '%',
    }
])
</script>

<template>
  <!-- <ul class="user_Overview flex">
    <li class="user_Overview-item" style="color: #00fdfa">
      <div class="user_Overview_nums allnum">
        <CountUp :endVal="state.totalNum" :duration="duration" />
      </div>
      <p>短视频总数</p>
    </li>
    <li class="user_Overview-item" style="color: #07f7a8">
      <div class="user_Overview_nums online">
        <CountUp :endVal="state.onlineNum" :duration="duration" />
      </div>
      <p>抖音</p>
    </li>
    <li class="user_Overview-item" style="color: #e3b337">
      <div class="user_Overview_nums offline">
        <CountUp :endVal="state.offlineNum" :duration="duration" />
      </div>
      <p>小红书</p>
    </li>
    <li class="user_Overview-item" style="color: #f5023d">
      <div class="user_Overview_nums laramnum">
        <CountUp :endVal="state.alarmNum" :duration="duration" />
      </div>
      <p>蝴蝶号</p>
    </li>
  </ul> -->
  <BarLeft :progressData="progressData" style="width: 100%;height: 100%;" :showDivider="true"></BarLeft>
</template>

<style scoped lang="less">
.left-top {
  width: 100%;
  height: 100%;
}

.user_Overview {
  li {
    flex: 1;

    p {
      text-align: center;
      height: 16px;
      font-size: 16px;
    }

    .user_Overview_nums {
      width: 100px;
      height: 100px;
      text-align: center;
      line-height: 100px;
      font-size: 22px;
      margin: 50px auto 30px;
      background-size: cover;
      background-position: center center;
      position: relative;

      &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
      }

      &.bgdonghua::before {
        animation: rotating 14s linear infinite;
      }
    }

    .allnum {
      &::before {
        background-image: url("@/assets/img/left_top_lan.png");
      }
    }

    .online {
      &::before {
        background-image: url("@/assets/img/left_top_lv.png");
      }
    }

    .offline {
      &::before {
        background-image: url("@/assets/img/left_top_huang.png");
      }
    }

    .laramnum {
      &::before {
        background-image: url("@/assets/img/left_top_hong.png");
      }
    }
  }
}
</style>
